<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>MTB CAT1 Peripheral driver library: Mixer        (Audio Mixer)</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><a href="http://www.cypress.com/"><img alt="Logo" src="IFXCYP_one-line.png"/></a></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">MTB CAT1 Peripheral driver library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__group__mixer.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#groups">API Reference</a>  </div>
  <div class="headertitle">
<div class="title">Mixer (Audio Mixer)</div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">General Description</h2>
<p>The Mixer driver provides APIs to configure the audio mixer. </p>
<p>The functions and other declarations used in this driver are in cy_mixer.h. You can include cy_pdl.h (ModusToolbox only) to get access to all functions and declarations in the PDL.</p>
<p>Features:</p><ul>
<li>Combines multiple PCM source streams into a single PCM destination stream.</li>
<li>Typically, a PCM source stream consists of a repetition of a PCM sample pattern in memory. The number of repetitions is dynamic; that is, at the stream start, the stream end may not be known. Typically, a system event activates (starts) a PCM source stream and another system event deactivates (ends) a PCM source stream.</li>
<li>A PCM source stream can be gain/volume controlled.</li>
<li>A PCM source stream can be faded in (typically at the stream start) and faded out (typically just before the stream end).</li>
<li>A PCM source stream sample frequency has a specific ratio with respect to the PCM destination stream sample frequency: 0.5x, 1x, 2x, 3x, 4x, 6x, 8x, 12x. The mixer upscales (2x, 3x, ..., 12x) or down-scales (0.5x) the PCM source stream to the PCM destination stream.</li>
<li>The PCM destination stream can be gain/volume controlled.</li>
<li>The PCM destination stream can be faded in and faded out.</li>
<li>Fixed PCM sample formatting: 16-bit pairs.</li>
<li>I2S transmitter with master and slave functionality. See the device datasheet to confirm whether this feature is supported.</li>
</ul>
<h1><a class="anchor" id="group_mixer_configuration"></a>
Configuration Considerations</h1>
<p>To set up an audio mixer, initialize the mixer destination and one or more source streams.</p>
<p>The mixer destination can be configured by providing all of the parameters in the <a class="el" href="structcy__stc__mixer__dst__config__t.html">cy_stc_mixer_dst_config_t</a> structure. Then call the <a class="el" href="group__group__mixer__functions.html#gaa7e1872f99d71971854b6801416da4d3">Cy_Mixer_DestinationInit</a> function to initialize the mixer destination. Additional APIs are provided to configure and control the mixer destination after initialization.</p>
<p>A mixer source can be configured by providing all of the parameters in the <a class="el" href="structcy__stc__mixer__src__config__t.html">cy_stc_mixer_src_config_t</a> structure. Then call the <a class="el" href="group__group__mixer__functions.html#gab6a2943ef38a0676a12898430a705356">Cy_Mixer_SourceInit</a> function to initialize the mixer source. Additional APIs are provided to configure and control the mixer source after initialization.</p>
<p>For the mixer to operate, the destination and one or more sources must be enabled and activated. Typically, enabling a source is done at mixer initialization time and activating/deactivating a source is done at a finer grain, based on system events that activate (start) and/or deactivate (end) PCM source streams.</p>
<p>Destination initialization example: </p><div class="fragment"><div class="line">    <span class="comment">/* Scenario: Set up and start a mixer destination */</span></div><div class="line">    <a class="code" href="structcy__stc__mixer__dst__config__t.html">cy_stc_mixer_dst_config_t</a> config = {</div><div class="line">        .fadeCode = <a class="code" href="group__group__mixer__enums.html#gga334246feca3f0b5de41659a5be3fac19a9f2f6f64554815c6e0222ea341b20115">CY_MIXER_CODE_SAME</a>,</div><div class="line">        .gainCode = 115,</div><div class="line">        .trgLevel = 0,</div><div class="line">    };</div><div class="line"></div><div class="line">    <span class="comment">/* Apply mixer destination configuration */</span></div><div class="line">    <a class="code" href="group__group__mixer__functions.html#gaa7e1872f99d71971854b6801416da4d3">Cy_Mixer_DestinationInit</a>(MIXER0_MIXER_DST_STRUCT, &amp;config);</div><div class="line"></div><div class="line">    <span class="comment">/* Enable the mixer destination */</span></div><div class="line">    <a class="code" href="group__group__mixer__functions.html#gab6b788e4488bb12870a09de607b6ca07">Cy_Mixer_Dst_Enable</a>(MIXER0_MIXER_DST_STRUCT);</div><div class="line"></div><div class="line">    <span class="comment">/* Activate the mixer destination */</span></div><div class="line">    <a class="code" href="group__group__mixer__functions.html#ga74de358abe1d10e4494c4c8e8cb4046f">Cy_Mixer_Dst_Activate</a>(MIXER0_MIXER_DST_STRUCT);</div><div class="line"></div></div><!-- fragment --><p> Source initialization example: </p><div class="fragment"><div class="line">    <span class="comment">/* Scenario: Set up and start a mixer source */</span></div><div class="line">    <a class="code" href="structcy__stc__mixer__src__config__t.html">cy_stc_mixer_src_config_t</a> config = {</div><div class="line">        .fsRatio = <a class="code" href="group__group__mixer__enums.html#gga1ba0c3c30874531b12bdedc2a12b1b56a9003bc5fb3495b8bfb8c5203c444bb4d">CY_MIXER_SRC_FREQ_NO_RESAMPLE</a>,</div><div class="line">        .ch0sel = <a class="code" href="group__group__mixer__enums.html#ggaaf90afc23795caba02f43ede81107240aea4e8c40874465c53fd360131b13f88e">CY_MIXER_SRC_DATA_LOW</a>,</div><div class="line">        .ch1sel = <a class="code" href="group__group__mixer__enums.html#ggaaf90afc23795caba02f43ede81107240acf57802fa73a3a7f2916097d4328bd5c">CY_MIXER_SRC_DATA_HIGH</a>,</div><div class="line">        .fadeCode = <a class="code" href="group__group__mixer__enums.html#gga334246feca3f0b5de41659a5be3fac19a1165c4023e9e1656c9dd30a7828f713c">CY_MIXER_CODE_MUTE</a>,</div><div class="line">        .gainCode = 115,</div><div class="line">        .trgLevel = 0,</div><div class="line">    };</div><div class="line"></div><div class="line">    <span class="comment">/* Apply mixer source configuration */</span></div><div class="line">    <a class="code" href="group__group__mixer__functions.html#gab6a2943ef38a0676a12898430a705356">Cy_Mixer_SourceInit</a>(MIXER0_MIXER_SRC_STRUCT0, &amp;config);</div><div class="line"></div><div class="line">    <span class="comment">/* Enable the mixer source */</span></div><div class="line">    <a class="code" href="group__group__mixer__functions.html#ga1af9217985d0fcbe41d588a5e56e1de7">Cy_Mixer_Src_Enable</a>(MIXER0_MIXER_SRC_STRUCT0);</div><div class="line"></div><div class="line">    <span class="comment">/* Activate the mixer source */</span></div><div class="line">    <a class="code" href="group__group__mixer__functions.html#ga650f0f67e1d3b60f890e23f726c9ac99">Cy_Mixer_Src_Activate</a>(MIXER0_MIXER_SRC_STRUCT0);</div><div class="line"></div></div><!-- fragment --><p> Mixer sources and destinations may be written and read by the MCU (via the provided APIs: <a class="el" href="group__group__mixer__functions.html#ga653029ab6e50fb0a419c42d0cbb300d0">Cy_Mixer_Src_FifoWriteData</a>, <a class="el" href="group__group__mixer__functions.html#ga3048fb727b40e6103a0cf8e933a8ba2b">Cy_Mixer_Dst_FifoReadData</a>) or by DMA. If using DMA, the DMA channel should be previously configured. Triggers generated by the Mixer can be used to initiate DMA transfers to and from the mixer source and destination FIFOs.</p>
<h1><a class="anchor" id="group_mixer_more_information"></a>
More Information.</h1>
<p>See the Mixer chapter of the device technical reference manual (TRM).</p>
<h1><a class="anchor" id="group_mixer_changelog"></a>
Changelog</h1>
<table class="doxtable">
<tr>
<th>Version</th><th>Changes</th><th>Reason for Change </th></tr>
<tr>
<td>1.0 </td><td>The initial version. </td><td></td></tr>
</table>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="groups"></a>
API Reference</h2></td></tr>
<tr class="memitem:group__group__mixer__macros"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__mixer__macros.html">Macros</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__group__mixer__functions"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__mixer__functions.html">Functions</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__group__mixer__data__structures"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__mixer__data__structures.html">Data Structures</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__group__mixer__enums"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__mixer__enums.html">Enumerated Types</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part
<div id="nav-path" class="navpath">
    <ul>
        <li class="footer">
            Generated for <b>MTB CAT1 Peripheral driver library</b> by <b>Cypress Semiconductor Corporation</b>.
            All rights reserved.
        </li>
    </ul>
</div>
-->
</body>
</html>
